package models;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.Index;
import javax.persistence.Id;

import com.googlecode.objectify.annotation.Cached;
import com.googlecode.objectify.annotation.Indexed;
import com.googlecode.objectify.annotation.NotSaved;
import com.googlecode.objectify.annotation.Unindexed;

import debugs.UserDebug;

@SuppressWarnings("serial")
@Cached
public class UserModel implements Serializable, Cloneable {
	@Id
	private String username = "";

	@Indexed
	private String password = "";

	@NotSaved
	private String rePassword = "";

	@NotSaved
	private String oldPassword = "";

	@Unindexed
	private String name = "";

	@Unindexed
	private String mobile = "";

	@Unindexed
	private int gender = 0; // 0:male, 1: female

	@Unindexed
	private Date birthday = new Date();

	@Unindexed
	private int status = 0; // 0-inactive, 1-active

	@NotSaved
	private String day = "01";

	@NotSaved
	private String month = "01";

	@NotSaved
	private String year = "2012";

	@Unindexed
	private String city = "";

	@Unindexed
	private String district = "";

	@Unindexed
	private String ward = "";

	@Unindexed
	private String address = "";

	@Unindexed
	private String street = "";

	@Unindexed
	private String floor = "";

	@Unindexed
	private String phone = "";

	@Index
	private String codeReset = "";
	
	@Unindexed
	private Date expired = new Date();
	
	public String getFloor() {
		return floor;
	}

	public void setFloor(String floor) {
		this.floor = floor;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getRePassword() {
		return rePassword;
	}

	public void setRePassword(String rePassword) {
		this.rePassword = rePassword;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getDay() {
		return day;
	}

	public void setDay(String day) {
		this.day = day;
	}

	public String getMonth() {
		return month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String getOldPassword() {
		return oldPassword;
	}

	public void setOldPassword(String oldPassword) {
		this.oldPassword = oldPassword;
	}

	public Object clone() throws CloneNotSupportedException {
		return super.clone();
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getDistrict() {
		return district;
	}

	public void setDistrict(String district) {
		this.district = district;
	}

	public String getWard() {
		return ward;
	}

	public void setWard(String ward) {
		this.ward = ward;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getCodeReset() {
		return codeReset;
	}

	public void setCodeReset(String codeReset) {
		this.codeReset = codeReset;
	}

	public Date getExpired() {
		return expired;
	}

	public void setExpired(Date expired) {
		this.expired = expired;
	}

	public boolean isFullProfile() {
		if (this.getName() == null || this.getName().equals("")) {
			return false;
		}
		if (this.getCity() == null || this.getCity().equals("")) {
			return false;
		}
		if (this.getDistrict() == null || this.getDistrict().equals("")) {
			return false;
		}
		if (this.getWard() == null || this.getWard().equals("")) {
			return false;
		}
		if (this.getWard() == null || this.getWard().equals("")) {
			return false;
		}
		if (this.getAddress() == null || this.getAddress().equals("")) {
			return false;
		}
		if (this.getStreet() == null || this.getStreet().equals("")) {
			return false;
		}
		if (this.getPhone() == null || this.getPhone().equals("")) {
			return false;
		}		
		return true;
	}
}
